package spa.persistencia;
/**
 *
 * @author Valdi Geraldo - valdi.ads@gmail.com
 */
import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;

public class ConnectionFactory {

    private static EntityManagerFactory managerFactory;

    private ConnectionFactory(){

    }

    public static EntityManager getEntityManager(){
        if(managerFactory == null){
            managerFactory = Persistence.createEntityManagerFactory("JPAUnit");
        }
        return managerFactory.createEntityManager();
    }
}
